Skip to content

feat(aci): Separate Buffer for Workflows #97549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 13, 2025
Merged

feat(aci): Separate Buffer for Workflows #97549

merged 6 commits into from
Aug 13, 2025

Conversation

kcons
Copy link
Member

@kcons kcons commented Aug 9, 2025

Buffer reliability is critical and has been proven to be a potential stability risk as we scale up.
To allow Workflows infrastructure to fail without impacting the legacy system and to enable the use
of newer backends without migrating live load, it's helpful to give Workflows it's own Buffer.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 9, 2025
Copy link

codecov bot commented Aug 9, 2025

Codecov Report

❌ Patch coverage is 98.00000% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../sentry/workflow_engine/tasks/delayed_workflows.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #97549      +/-   ##
==========================================
+ Coverage   79.98%   80.64%   +0.65%     
==========================================
  Files        8588     8587       -1     
  Lines      378443   378374      -69     
  Branches    24642    24632      -10     
==========================================
+ Hits       302709   305128    +2419     
+ Misses      75362    72874    -2488     
  Partials      372      372              

@kcons kcons marked this pull request as ready for review August 12, 2025 17:45
@kcons kcons requested review from a team as code owners August 12, 2025 17:45
@kcons kcons requested a review from saponifi3d August 12, 2025 17:46
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm if we're okay to remove the buffer hook registry in the legacy code.

FLUSH = "flush"


class BufferHookRegistry:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this yet? i'm mostly concerned about the legacy delayed_processor code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be okay, though it is hard to reason about.
The task now called process_buffer directly, and process buffer uses the registry to pick the right backend for the right delayed processor.
Though, I didn't think too hard about what the registry was trying to accomplish, so I may be missing something. 😬

buffer_keys,
min=0,
max=fetch_time,
)


if not redis_buffer_registry.has(BufferHookEvent.FLUSH):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 - i never liked this code. just curious, if we want to add another handler when the buffer is flushed, would we have to manually add it to tasks/process_buffer.py::process_pending_batch? should we have a registry hook there or is this uncommon enough that we can be explicit about it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we've made it so there isn't just One buffer anymore, and the dispatching to the appropriate buffer is now handled by the config in delayed_processing_registry.
For the delayed processing-style batch scheduling, this seem sufficiently extensible (presumably, in some month it'll only be dispatching to workflows, and we may want to split "Buffer" as our method set is fairly independent and can pretty much work with a redis client), so I'm not too concerned with generalizing the pattern.

Copy link
Contributor

Seer failed to run.

@kcons kcons merged commit 73d312e into master Aug 13, 2025
64 checks passed
@kcons kcons deleted the kcons/ourbuf branch August 13, 2025 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants